package com.addplus.townmall.server.queue.serviceimpl;

import com.addplus.townmall.server.api.model.town.param.ShopProductStockManagerParam;
import com.addplus.townmall.server.api.modelenum.QueueEnum;
import com.addplus.townmall.server.api.service.queue.ShopProductStockManagerService;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 类名: OrderCreateService
 *
 * @author zhangjiehang
 * @version V1.0
 * @date 2018/10/5 下午7:00
 * @description 类描述: 商城订单生成队列服务实现类
 */
@Service(interfaceClass = ShopProductStockManagerService.class,async = true)
public class ShopProductStockManagerServiceImpl implements ShopProductStockManagerService {

    @Autowired
    private RabbitTemplate rabbitTemplate;


    @Override
    public void stockMangerQueue(ShopProductStockManagerParam shopProductStockManagerParam) {
        if (shopProductStockManagerParam != null) {
            rabbitTemplate.convertAndSend(QueueEnum.STOCK_MANAGER.getExchange(), QueueEnum.STOCK_MANAGER.getRoutingKey(), shopProductStockManagerParam);
        }
    }
}
